

    // lets create a custom object
    CustomObject.implement
    (
        
        function method () 
        {
            alert('method invoked');   
        }
    
    );
    
    function CustomObject () 
    {
        
    };
    
    // and lets create a sublcass
    
    Child.inherit(CustomObject).implement
    (
        
        /*
         * You may expect that this method will override the 
         * CustomObject.prototype.method, but by default,  
         */
        function method () 
        {
            alert('child method invoked');
        }
    );
    
    function Child () 
    {
        CustomObject.call(this);
    };
    
    var child= new Child;
    child.method(); // alerts method invoked!- the child method did not override
    
    // so to override, you must first disable preventOverride
    
    Child.implement.preventOverride= false;
    Child.implement
    (
    
        function method () 
        {
            alert('this will override!')
        }
    );
    
    child.method(); // alerts 'this will override!'
    
    // you must do this every time you want to override a batch of methods
    // it may be seem an inconvenience, but it helps if you extend native objects
    // and you want to make sure you don't inadvertantly override native
    // implementations
    
    
    Array.implement
    (
    
        // this would not override the native push method of Array as after each
        // call to implement, on any constructor, the preventOverride property
        // is reset to true
        function push () 
        {
            throw new Error('FUBAR');
        }
    );
    
    Array.implement.preventOverride= false;
    Array.implement
    (
        
        // but this will!
        function push () 
        {
            throw new Error('ReallyFUBAR')
        }
    );
    
    // such are the wonders of JavaScripts prototypal inheritance
    // that the following statements are true
    
    Function.prototype.implement.preventOverride= false;
    
    alert(Array.implement.preventOverride === Child.implement.preventOverride 
    && Function.prototype.implement.preventOverride === String.implement.preventOverride) // true
    
    
    
    
